<?php
if(!defined('ADMIN')){
	exit('Access Denied');
}

include_once (EZROOT . '/libs/Uploader.class.php');
$config = array(
    "savePath" =>"upload",
    "maxSize" => 10240, //单位KB
    "allowFiles" => array(".gif", ".png", ".jpg", ".jpeg", ".bmp")
);
$title = htmlspecialchars($_POST['pictitle'], ENT_QUOTES);
    
$up = new Uploader("upfile", $config);
$info = $up->getFileInfo();


echo "{'url':'" . $info["url"] . "','title':'" . $title . "','original':'" . $info["originalName"] . "','state':'" . $info["state"] . "'}";

$data=array(
"title"=>$title,
"filename"=>$info["originalName"],
"filepath"=>$info["url"],
"filesize"=>$info["size"],
"isimage"=>1,
"fileext"=>$info["type"],
"userid"=>$_SESSION['EZ_Admin']['id'],
"uploadtime"=>time(),
"uploadip"=>get_client_ip()

);
//$id=$ezhand->insert("attachment",$data);
?>